package com.example.shiro01.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class jiam {

    public static String MD5Pwd(String username, String pwd) {
        String hashAlgorithmName = "MD5";//加密方式
        Object crdentials = pwd;//密码原值
        ByteSource salt = ByteSource.Util.bytes(username);//以账号作为盐值
        int hashIterations = 1024;//加密1024次
        return new SimpleHash(hashAlgorithmName,crdentials,salt,hashIterations).toString();
    }
}
